package org.springframework.ai.openai.samples.helloworld;

import org.springframework.ai.openai.api.OpenAiAudioApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

// 更多问题可以关注公众号《程序员徐庶》加入徐庶答疑社区一起交流
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        // 设置代理，这里可以网上找一些免费代理，或者收费代理
        String proxy = "127.0.0.1";  // 100.100.101.235 8811  示例，里面填具体的代理ip
        int port = 7890;   //代理的端口，
        System.setProperty("proxyType", "4");
        System.setProperty("proxyPort", Integer.toString(port));
        System.setProperty("proxyHost", proxy);
        System.setProperty("proxySet", "true");

        SpringApplication.run(Application.class, args);

    }


    @Bean
    public OpenAiAudioApi openAiAudioApi(@Value("${OPEN_AI_KEY}") String openAiKey){
        return new OpenAiAudioApi(openAiKey);
    }

}
